# -*- makefile -*- Automake include file
# $Id: autodocs-ycp.ami 33394 2006-10-13 11:51:40Z mvidner $

# Builds source documentation for YCP sources
# Uses ycpdoc
# PARAMETERS:
#   AUTODOCS_YCP: Files that the ycp autodocs is built from
#   		  Optional - the default is $(srcdir)/../../src/*.ycp
#   AUTODOCS_PM: Files that the perl autodocs is built from
#   		  Optional - the default is $(srcdir)/../../src/*.pm

htmldir = $(docdir)/autodocs

html_DATA = index.html $(wildcard *.html)
CLEANFILES = $(html_DATA) pod2htm*.tmp

AUTODOCS_YCP ?= $(wildcard $(srcdir)/../../src/*.ycp)
AUTODOCS_PM  ?= $(wildcard $(srcdir)/../../src/*.pm)

index.html: $(AUTODOCS_YCP) $(AUTODOCS_PM)
#including *.pm, for the index
	${YCPDOC} -d. $^
	for i in $(AUTODOCS_PM); do \
		b=`basename $$i`; b=$${b%.pm}; \
		pod2html --title=$$b --infile=$$i --outfile=$$b.html; \
		echo "<a href='$$b.html'>$$b</a>" > $$b.mod.html; \
	done
